﻿using NET6.WebAPI.Entities.Base;
using NET6.WebAPI.Exceptions;
using static NET6.WebAPI.Entities.Base.ExamineBase;

namespace NET6.WebAPI.Extensions
{
    public static class ExamineExtension
    {
        /// <summary>
        /// 检查记录是否为指定审核状态
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="enetity"></param>
        /// <param name="status"></param>
        public static void ChcekExamineStatus<T>(this T? enetity, ExamineStatusEnum status) where T : ExamineBase
        {
            if (enetity == null || enetity.ExamineStatus != status)
            {
                throw new InvalidStatusException();
            }
        }
    }
}
